<?php

/**
 * Researcher filter form base class.
 *
 * @package    Redsea20
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseResearcherFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'firstname'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'lastname'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'emailaddress' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'password'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'university'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'position'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'address'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'contact'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'gender'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'birthdate'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'picture'      => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'firstname'    => new sfValidatorPass(array('required' => false)),
      'lastname'     => new sfValidatorPass(array('required' => false)),
      'emailaddress' => new sfValidatorPass(array('required' => false)),
      'password'     => new sfValidatorPass(array('required' => false)),
      'university'   => new sfValidatorPass(array('required' => false)),
      'position'     => new sfValidatorPass(array('required' => false)),
      'address'      => new sfValidatorPass(array('required' => false)),
      'contact'      => new sfValidatorPass(array('required' => false)),
      'gender'       => new sfValidatorPass(array('required' => false)),
      'birthdate'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'picture'      => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('researcher_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Researcher';
  }

  public function getFields()
  {
    return array(
      'id'           => 'Number',
      'firstname'    => 'Text',
      'lastname'     => 'Text',
      'emailaddress' => 'Text',
      'password'     => 'Text',
      'university'   => 'Text',
      'position'     => 'Text',
      'address'      => 'Text',
      'contact'      => 'Text',
      'gender'       => 'Text',
      'birthdate'    => 'Date',
      'picture'      => 'Text',
    );
  }
}
